package com.yegs.hospital.service.impl;

import com.yegs.hospital.dao.CaptchaDao;
import com.yegs.hospital.service.CaptchaService;
import com.yegs.hospital.vo.Captcha;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CaptchaServiceImpl implements CaptchaService {


    @Autowired
    private CaptchaDao captchaDao;

    @Override
    public void save(Captcha captcha) {
        captchaDao.save(captcha);
    }

    @Override
    public Captcha get() {
        List<Captcha> all = captchaDao.findAll();
        if(all.size() > 0){
            return all.get(all.size() -1);
        }
        return null;
    }
}
